package com.wiscofile.dao;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;

import com.wiscofile.pojo.BaseUser;


/**
 * A data access object (DAO) providing persistence and search support for
 * BaseUser entities. Transaction control of the save(), update() and delete()
 * operations can directly support Spring container-managed transactions or they
 * can be augmented to handle user-managed Spring transactions. Each of these
 * methods provides additional information for how to configure it for the
 * desired type of transaction control.
 * 
 * @see com.wiscofile.pojo.BaseUser
 * @author MyEclipse Persistence Tools
 */

public class BaseUserDAO extends BaseHibernateDAO {
	private static final Log log = LogFactory.getLog(BaseUserDAO.class);

	public BaseUser login(String username,String password){
		Query q = getSession().createQuery("select b from BaseUser b where b.userCode = '"+username+"' and b.userPwd = '" +password+"'");
		List list = q.list();
		if(list.size()>0){
			BaseUser bu = (BaseUser) list.get(0);
			return bu;
		}
		return null;
	}
}